package com.healthcloud.entity;

import com.healthcloud.enums.DiseaseTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 病人档案
 */
public class PpPatientBaseExtVo extends PpPatientBaseVo {


    private String diseaseName;

    public String getDiseaseName() {

        Map<Integer, String> diseaseMap = new HashMap<>();

        for (DiseaseTypeEnum diseaseTypeEnum : DiseaseTypeEnum.values()) {
            diseaseMap.put(diseaseTypeEnum.getCode(), diseaseTypeEnum.getMsg());
        }

        StringBuilder diseaseNames = new StringBuilder();
        if (StringUtils.isNotBlank(getDiseasesType())) {
            String[] diseaseTypes = getDiseasesType().split("\\,");
            if (diseaseTypes.length > 0) {
                for (DiseaseTypeEnum diseaseTypeEnum : DiseaseTypeEnum.values()) {
                    for (String diseaseType : diseaseTypes) {
                        if (Integer.valueOf(diseaseType) == diseaseTypeEnum.getCode()) {
                            diseaseNames.append(diseaseTypeEnum.getMsg() + ",");
                        }
                    }
                }
            }
        }


        return diseaseNames.toString();
    }

    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }

    public static void main(String[] args) {

        String[] str = "5".split("\\,");
        System.out.println(str.toString());
    }
}
